package org.java.order.conf;

import org.java.order.interceptor.OrderInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author WHQ
 * @version 1.0
 * @date 2022-3-13 0013 下午 2:52
 */
//标识为配置类
@Configuration
public class OrderWebConf implements WebMvcConfigurer {
    //注入需要进入的拦截器
    @Autowired
    private OrderInterceptor cartInterceptor;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //设置在任何请求下都进入到拦截器
        registry.addInterceptor(cartInterceptor).addPathPatterns("/**");
        WebMvcConfigurer.super.addInterceptors(registry);
    }
}
